﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LogTemp.aspx.cs" Inherits="Workflow.Project.LogTemp" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
     <link rel="stylesheet" type="text/css" href="../Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="../Css/style.css" />
    <script type="text/javascript" src="../Js/jquery.js"></script>
    <script type="text/javascript" src="../Js/jquery.sorted.js"></script>
    <script type="text/javascript" src="../Js/bootstrap.js"></script>
    <script type="text/javascript" src="../Js/ckform.js"></script>
    <script type="text/javascript" src="../Js/common.js"></script>

    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }
        .yellowtext{
            color:#f4bb52;
        }
        .redText{
            color:#f4528b;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        
        }


    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="txtPJLogId" runat="server" Visible="false"></asp:TextBox>
        <table class="table table-bordered table-hover definewidth m10">
            <tr>
                <td class="tableleft">模具号</td>
                <td><asp:TextBox ID="txtPJNo" runat="server" Enabled="false"></asp:TextBox> &nbsp;<asp:Button ID="Search" CssClass="btn btn-primary" runat="server" Text="查询" OnClick="Search_Click"/></td>
                <td></td>
            </tr>
            <tr class="tr">
                <td class="tableleft">阶段</td>
                <td><asp:DropDownList ID="ddlStage" runat="server" Enabled="false">
                    <asp:ListItem>阶段T0</asp:ListItem>
                    <asp:ListItem>阶段T1</asp:ListItem>
                    <asp:ListItem>阶段T2</asp:ListItem>
                    <asp:ListItem>阶段T3</asp:ListItem>
                    <asp:ListItem>阶段T4</asp:ListItem>
                    <asp:ListItem>阶段T5</asp:ListItem>
                    </asp:DropDownList></td>
                <td></td>
            </tr>
            <tr class="tr">
                <td class="tableleft">节点</td>
                <td><asp:DropDownList ID="ddlNode" runat="server" Enabled="false">
                    <asp:ListItem></asp:ListItem>
                    <asp:ListItem>FOT</asp:ListItem>
                    <asp:ListItem>OTS</asp:ListItem>
                    <asp:ListItem>T/R</asp:ListItem>
                    <asp:ListItem>PPAP</asp:ListItem>
                    <asp:ListItem>PSW</asp:ListItem>
                    <asp:ListItem>进入爬坡</asp:ListItem>
                    <asp:ListItem>退出爬坡</asp:ListItem>
                    </asp:DropDownList></td>
                <td></td>
            </tr>
            <tr class="tr">
                <td class="tableleft">项目活动/问题</td>
                <td><asp:TextBox ID="txtProblem" runat="server" Height="82px" TextMode="MultiLine" Width="281px" Enabled="false"></asp:TextBox></td>
                <td></td>
            </tr>
            <tr class="tr">
                <td class="tableleft">来源</td>
                <td><asp:TextBox ID="txtSource" runat="server" Enabled="false"></asp:TextBox></td>
                <td></td>
            </tr>
            <tr class="tr">
                <td class="tableleft">责任人</td>
                <td><asp:TextBox ID="txtPerson" runat="server" Enabled="false"></asp:TextBox></td>
                <td></td>
            </tr>
            <tr class="tr">
                <td class="tableleft">责任部门</td>
                <td><asp:DropDownList ID="ddlDepartment" runat="server" Enabled="false">
                    <asp:ListItem>市场部</asp:ListItem>
                    <asp:ListItem>财务部</asp:ListItem>
                    <asp:ListItem>产品开发部</asp:ListItem>
                    <asp:ListItem>制造技术部</asp:ListItem>
                    <asp:ListItem>制造部</asp:ListItem>
                    <asp:ListItem>物流部</asp:ListItem>
                    <asp:ListItem>品质管理部</asp:ListItem>
                    <asp:ListItem>生产运营部</asp:ListItem>
                    <asp:ListItem>线圈事业部</asp:ListItem>
                    </asp:DropDownList></td>
                <td></td>
            </tr>
            <tr class="tr">
                <td class="tableleft">状态</td>
                <td><asp:DropDownList ID="ddlStatues1" runat="server" Enabled="false">
                    <asp:ListItem>进行中</asp:ListItem>
                    <asp:ListItem>已完成</asp:ListItem>
                    </asp:DropDownList></td>
                <td></td>
            </tr>
            <tr class="tr">
                <td class="tableleft">紧急程度</td>
                <td><asp:DropDownList ID="ddlDegree" runat="server" Enabled="false">
                    <asp:ListItem>低</asp:ListItem>
                    <asp:ListItem>中</asp:ListItem>
                    <asp:ListItem>高</asp:ListItem>
                    </asp:DropDownList></td>
                <td></td>
            </tr>
            <tr class="tr">
                <td class="tableleft">活动/问题发生时间</td>
                <td><input type="date" id="txtStartDate" name="txtStartDate"/></td>
                <td></td>
            </tr>
            <tr class="tr">
                <td class="tableleft">规定完成时间</td>
                <td><input type="date" id="txtCompleteDate" name="txtCompleteDate"/></td>
                <td></td>
            </tr>
            <tr class="tr">
                <td class="tableleft">最终完成时间</td>
                <td><input type="date" id="txtRealCompleteDate" name="txtRealCompleteDate"/></td>
                <td></td>
            </tr>
            <tr class="tr">
                <td class="tableleft">更改原因</td>
                <td><asp:TextBox ID="txtReason" runat="server" Height="82px" TextMode="MultiLine" Width="281px" Enabled="false"></asp:TextBox></td>
                <td></td>
            </tr>
            <tr class="tr">
                <td class="tableleft">备注</td>
                <td><asp:TextBox ID="txtPs" runat="server" Height="82px" TextMode="MultiLine" Width="281px" Enabled="false"></asp:TextBox></td>
                <td></td>
            </tr>
            <tr class="tr">
                <td class="tableleft">同步</td>
                <td><asp:TextBox ID="txtStatues" runat="server" Enabled="false"></asp:TextBox></td>
                <td></td>
            </tr>
            <tr class="tr">
                <td class="tableleft"></td>
                <td>
                    <asp:Button ID="Create" CssClass="btn btn-primary" runat="server" Text="确定" OnClientClick="return Validate()"  OnClick="Create_Click"/>
                    <asp:Button ID="Update" CssClass="btn btn-primary" runat="server" Text="确定" OnClientClick="return Validate()" Visible="false" OnClick="Update_Click"/>
                    <asp:Button ID="UpdateStatues" CssClass="btn btn-primary" runat="server" Text="数据同步" OnClientClick="return Validate()" Visible="false" OnClick="UpdateStatues_Click"/>
                </td>
                <td></td>
            </tr>

        </table>
        <%if(result==null){%>
         <table class="table table-bordered definewidth m10">
            <thead>                   
                <tr>
                    <th>模具号</th>
                    <th>项目活动/问题</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>  
                <% for (int i = 0; i < searchResult.Count; i++){ %>
                    <tr class="result">
                        <td><%= searchResult[i].PJId %></td>
                        <td><% =searchResult[i].Problem %></td>
                        <td><a href="#" id="<%= searchResult[i].Id %>">选择</a></td>
                    </tr>
                <% }%>
            </tbody>
        </table>
        <% }%>
    </div>
    </form>
    <script>
        $(document).ready(function () {
            <% if (pjCount==0 || statusNo!=0) {%>
                document.getElementById('txtStartDate').disabled = "disabled";
                document.getElementById('txtCompleteDate').disabled = "disabled";
                document.getElementById('txtRealCompleteDate').disabled = "disabled";
            <%}%>
            <%if(result!=null){%>
                $("#txtStartDate").val('<% =result.StrStartDate%>');
                $("#txtCompleteDate").val('<% =result.StrCompleteDate%>');
                $("#txtRealCompleteDate").val('<% =result.StrRealCompleteDate%>');
            <%}else{%>
                $(".tr").hide();
            <%}%>
            $("a").click(function () {
                if (confirm("确认选择？")) {
                    var id = $(this).attr("id");
                    var url = "PJChoose.ashx?Type=PJChoose&Id=" + id;
                    $.ajax({
                        type: "Get",
                        url: url,
                        success: function (data) {
                            var result = $.parseJSON(data);
                            $(".tr").show();
                            $("#txtPJLogId").val(result.PJLogId);
                            $("#ddlStage").val(result.Stage);
                            $("#ddlNode").val(result.Node);
                            $("#txtProblem").val(result.Problem);
                            $("#txtSource").val(result.Source);
                            $("#txtPerson").val(result.Person);
                            $("#ddlDepartment").val(result.Department);
                            $("#ddlStatues1").val(result.Statues1);
                            $("#ddlDegree").val(result.Degree);
                            $("#txtStartDate").val(result.StrStartDate);
                            $("#txtCompleteDate").val(result.StrCompleteDate);
                            $("#txtRealCompleteDate").val(result.StrRealCompleteDate);
                            $("#txtPs").val(result.Ps);
                            $("#txtPJNo").attr("disabled", "disabled");
                            $("#Search").hide();
                            $("#ddlStage").removeAttr("disabled");
                            $("#ddlNode").removeAttr("disabled");
                            $("#txtProblem").removeAttr("disabled");
                            $("#txtSource").removeAttr("disabled");
                            $("#txtPerson").removeAttr("disabled");
                            $("#ddlDepartment").removeAttr("disabled");
                            $("#ddlStatues1").removeAttr("disabled");
                            $("#ddlDegree").removeAttr("disabled");
                            $("#txtStartDate").removeAttr("disabled");
                            $("#txtCompleteDate").removeAttr("disabled");
                            $("#txtRealCompleteDate").removeAttr("disabled");
                            $("#txtReason").removeAttr("disabled");
                            $("#txtPs").removeAttr("disabled");
                            $("#Create").show();
                        }
                    });
                    return false;
                }
            });
        });
    </script>
</body>
</html>

